#include <QPushButton>
#include <QLabel>
#include <QHBoxLayout>
#include "pushbutton.h"
#include "convertentryview.h"
#include "common.h"

ConvertEntryView::ConvertEntryView(QWidget *parent) :
    QWidget(parent)
{
    setFixedHeight(40);
    initUI();
    setButtonText();
    connect(this, SIGNAL(signalLanguageChanged()), this, SLOT(setButtonText()));
}

void ConvertEntryView::initUI()
{
    m_addProfileButton = new PushButton(this);
    m_addProfileButton->setFixedHeight(24);
    m_addProfileButton->setEnabled(false);

    m_clipButton = new PushButton(this);
    m_clipButton->setFixedHeight(24);
    m_clipButton->setEnabled(false);

    m_effectButton = new PushButton(this);
    m_effectButton->setFixedHeight(24);
    m_effectButton->setEnabled(false);

    QLabel *padleft = new QLabel(this);
    QLabel *padright = new QLabel(this);

    QHBoxLayout *layout = new QHBoxLayout;
    layout->addWidget(padleft);
    layout->addWidget(m_addProfileButton);
    layout->addWidget(m_clipButton);
    layout->addWidget(m_effectButton);
    layout->addWidget(padright);
    setLayout(layout);
}

void ConvertEntryView::slotFileSelectionChanged(bool hasFile, bool hasSelection)
{
    m_addProfileButton->setEnabled(hasSelection);
    m_clipButton->setEnabled(hasSelection);
    m_effectButton->setEnabled(hasSelection);
}

void ConvertEntryView::setButtonText()
{
    m_addProfileButton->setText(tr("  Add Profile  "));
    m_clipButton->setText(tr("Clip"));
    m_effectButton->setText(tr("Effect"));
}
